fix(publish): create GitHub Release on tag push - #95
Merged
Conversation
Adds a GitHub Release creation step to the publish workflow so the
`v*` tag push that ships a PyPI release also produces a GitHub
Release page with the wheel + sdist attached. Closes the "manual
changelog duplication" gap that 0.16.3 would otherwise hit: the
land-badge on the landing page would render 0.16.3 only after a
separate `gh release create` step, which would race the PyPI publish
job in the same workflow run.
Diff:
- `permissions.contents: write` on the publish job — required by
softprops/action-gh-release to push the release ref. Additive to
the existing `id-token: write` (which PyPI Trusted Publishing
needs); does NOT weaken the existing security posture since the
workflow already has `actions/checkout@v4` writing into `${{
github.workspace }}`.
- New step "Create GitHub Release" at the end of the publish job,
gated on `startsWith(github.ref, 'refs/tags/v')` so manual
workflow_dispatch re-runs (used for hotfix rebuilds) don't create
duplicate releases on branch refs. `generate_release_notes: true`
asks GitHub to auto-aggregate merged PR titles + labels into the
release body so the GH release page mirrors CHANGELOG.md without
manual editing. `files: dist/*.whl, dist/*.tar.gz` attaches the
same artifacts that PyPI receives, so the release page doubles
as a download mirror for environments where pip isn't available.
Pinned to `softprops/action-gh-release@v2` (matches the project
release-train convention). The latest stable release is v3.0.2; the
inputs used here (`tag_name`, `generate_release_notes`, `files`) are
identical between v2 and v3, so bumping is a one-line change when
desired.
No changes to test/, build, or PyPI publish step. The existing
`needs: test` dependency still gates the release creation on a
green test matrix.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(publish): create GitHub Release on tag push
Adds a GitHub Release creation step to
publish.ymlso thev*tag push that ships a PyPI release also produces a GitHub Release page with the wheel + sdist attached.Why
Today
publish.ymltriggers onpush: tags: ["v*"](orworkflow_dispatch) and runs only the PyPI Trusted Publishing step. PyPI gets the release, but the GitHub Releases page is left empty until someone manually runsgh release create vX.Y.Z. For 0.16.3 this would race the landing-page lib/github.ts badge cache (5-min TTL) — PyPI would be live, the GitHub Release page wouldn't, and the badge could show 0.16.3 before the release-notes page exists.This fix makes the same workflow run produce both artifacts atomically: PyPI publish → GitHub Release on the same commit, with
generate_release_notes: trueauto-aggregating merged PR titles so the GitHub release notes mirrorCHANGELOG.mdwithout manual editing.Diff
Single file, 24-line addition to
.github/workflows/publish.yml:Notes
contents: writeis additive to the existingid-token: write. The PyPI Trusted Publishing step doesn't need it, but the new release step does (it pushes a Git ref). The combined token scope is still strictly less thanwrite-all—id-token: writeis required by OIDC,contents: writeis required for the release ref push.if: startsWith(github.ref, 'refs/tags/v')gates the release on tag pushes only. Manualworkflow_dispatchruns (used for hotfix re-runs without re-tagging) won't create a duplicate release on the branch ref. The PyPI publish step runs unconditionally within the job —workflow_dispatchstill publishes to PyPI as today.generate_release_notes: trueasks GitHub to auto-aggregate merged PR titles + labels into the release body. This mirrorsCHANGELOG.mdwithout manual editing and is the recommended setup for projects with conventional-commit-style PRs.dist/*.whl,dist/*.tar.gz) mirror what PyPI receives, so the release page doubles as a download mirror for environments wherepipisn't available.softprops/action-gh-release@v2(matches the project release-train convention). Latest stable isv3.0.2; the inputs used here (tag_name,generate_release_notes,files) are identical between v2 and v3, so bumping is a one-line change when desired. v3.0.2 mainly adds improved release-creation diagnostics + Gitea asset replacement, neither of which this workflow needs.Verification
YAML parses cleanly:
The change does not affect
tests/,build/, or the PyPI publish step. The existingneeds: testdependency still gates release creation on a green test matrix.Roll-out
Once merged, the next
v*tag push (planned:v0.16.3after PR #94 merges) will produce:https://github.com/nullrunio/nullrun-sdk-python/releases/tag/v0.16.3with auto-generated notes and attached artifactslib/github.tscache TTL